<?
require_once('./lib/Config.php');
require_once('./lib/DB.gear.php');
require_once('./lib/Template.gear.php');
require_once('./lib/lib.gear.php');
require_once('./lib/lib.garden.php');

$user_id = $_GET['user_id'];
$text    = $_GET['text'];
$via     = $_GET['via'];
$pod_id  = $_GET['pod_id'];
$pod_name  = $_GET['pod_name'];
$invitee_id = $_GET['invitee_id'];
$location  = $_GET['location'];

	$url = 'http://reafo.net/garden/api/pod.php';
	$data = array(
	    'user_id'              => $user_id,
		'text'                 => $text,
		'via'                  => $via,
		'invitee_id'           => $invitee_id,
		'mixi_json'            => $contents,
		'pod_name'             => $pod_name,
		'text'                 => $text,
		'type'                 => 'start_pod',
		'location'             => $_GET['location'],
	    'g_key_din39s03j23ogn' => G_KEY,
	);

	$headers = array(
	    'Authorization: OAuth '.'todoke', 
	);

	$options = array('http' => array(
	    'method' => 'POST',
	    'content' => http_build_query($data),
	    'header' => implode("\r\n", $headers),
	));

	$contents = file_get_contents($url, false, stream_context_create($options));


    $comments = json_decode($contents, true);
    preDump($contents);

/*
$ses_data['mixi_access_token'] = 'def6dd1a49f3a439126a2735661d3537cdc7ec8b';

	$url = 'http://api.mixi-platform.com/2/people/@me/@friends?count=1000';
	$data = array(
	    'oauth_token' => $ses_data['mixi_access_token'],
	);

	$headers = array(
	    'Authorization: OAuth '.$ses_data['mixi_access_token'], 
	);

	$options = array('http' => array(
	    'method' => 'GET',
	    'content' => http_build_query($data),
	    'header' => implode("\r\n", $headers),
	));
	$contents = file_get_contents($url, false, stream_context_create($options));

	$jsonArray = json_decode($contents, true);
	preDump($jsonArray);

	$url = 'http://reafo.net/garden/api/user.php';
	$data = array(
	    'user_id'              => $user_id,
		'text'                 => $text,
		'via'                  => $via,
		'invitee_id'               => $invitee_id,
		'mixi_json'               => $contents,
		'type'               => 'add_friends',
		'location'           => $_GET['location'],
	    'g_key_din39s03j23ogn' => G_KEY,
	);

	$headers = array(
	    'Authorization: OAuth '.'todoke', 
	);

	$options = array('http' => array(
	    'method' => 'POST',
	    'content' => http_build_query($data),
	    'header' => implode("\r\n", $headers),
	));

	$contents = file_get_contents($url, false, stream_context_create($options));


    $comments = json_decode($contents, true);
    preDump($contents);
*/

/*
$user_id       = $_GET['user_id'];


	$url = 'http://reafo.net/garden/api/feed.php';
	$data = array(
	    'user_id'              => $user_id,
	    'g_key_din39s03j23ogn' => G_KEY,
	);

	if(isset($_GET['count']) && ($_GET['count'] > 0))
	{
		$data['count'] = $_GET['count'];
		
	}

	if(isset($_GET['startIndex']))
	{
	    $data['startIndex'] = $_GET['startIndex'];
	}

	$headers = array(
	    'Authorization: OAuth '.'todoke', 
	);

	$options = array('http' => array(
	    'method' => 'POST',
	    'content' => http_build_query($data),
	    'header' => implode("\r\n", $headers),
	));

	$contents = file_get_contents($url, false, stream_context_create($options));


    $comments = json_decode($contents, true);
    preDump($comments);
*/


?>
